using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace HamcoWcs.Entitys.PathInfos
{
    public class PathInfoConfig : IEntityTypeConfiguration<PathInfo>
    {
        public void Configure(EntityTypeBuilder<PathInfo> builder)
        {
            builder.HasComment("路径模块-路径表");
            builder.Property(x => x.PathName).IsRequired().HasMaxLength(30).HasComment("起点wmsnode-终点wmsnode");
            builder.Property(x => x.FromNode).IsRequired().HasMaxLength(30).HasComment("起点wmsnode");
            builder.Property(x => x.ToNode).IsRequired().HasMaxLength(30).HasComment("终点wmsnode");
            //builder.Property(x => x.PathValue).IsRequired().HasMaxLength(255).HasComment("路径节点明细，用‘-’连接");
            builder.Property(x => x.PathType).HasDefaultValue(0).HasComment("路径类型");
            builder.Property(x => x.DefaultPath).IsRequired().HasMaxLength(4096).HasComment("默认路径");
            builder.Property(x => x.AlternatePaths).IsRequired().HasMaxLength(4096).HasComment("备用路径");

            builder.HasIndex(x => x.PathName).IsUnique();
        }
    }
}